﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AuthorAttribute
{
    class Program
    {
        static void Main(string[] args)
        {
            Type type = typeof(Student);
            //获取到Student类的所有特性
            object[] objs = type.GetCustomAttributes(true);

            //循环判断我们我们获取到的objs数组
            foreach (object item in objs)
            {
                AuthorAttribute attr = item as AuthorAttribute;
                if (attr != null)
                    Console.WriteLine
                        (
                        "Author:" + attr.Author
                        + " Version Code:" + attr.VersionCode
                        + " Date Time:" + attr.DateTime
                        + " Remark:" + attr.Remark
                        );
            }

            Console.ReadKey();
        }
    }
}
